package com.jiaomatech.demo.order.fallback;

import com.jiaomatech.demo.order.dto.OrderDto;
import com.jiaomatech.demo.order.feign.OrderSearchFeign;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;

/**
 * Description: Fallback .<br>
 *
 * @author jm
 *     created by 2019/10/18
 */
public class OrderSearchFallback implements FallbackFactory<OrderSearchFeign> {
    private final static Logger logger = LoggerFactory.getLogger(OrderSearchFallback.class);

    @Override
    public OrderSearchFeign create(Throwable throwable) {
        return new OrderSearchFeign() {

            @Override
            public ResponseEntity<OrderDto> findOrderById(String userId) {
                logger.error("[订单服务] - [查询订单信息] - [异常]", throwable);
                return null;
            }
        };
    }
}